package com.hrt.datasender.web.bcsendplatformdatastrategy;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import com.btcode.web.core.annotation.RequestMapping;
import com.btcode.web.core.controller.Controller;
import com.hrt.common.web.DSRequestUnit;
import com.hrt.datasender.datadao.model.BcSendPlatformDataStrategyModel;
import com.hrt.datasender.datadao.service.BcSendPlatformDataStrategyService;

@RequestMapping(path = "BcSendPlatformDataStrategy")
public class BcSendPlatformDataStrategyController extends Controller {

    @RequestMapping(path = "getList")
    public void getList(ServletRequest arg0, ServletResponse arg1) throws IOException {
        String platformId = DSRequestUnit.getParameter("platformId");
        List<BcSendPlatformDataStrategyModel> list = BcSendPlatformDataStrategyService.getInstance()
                .getList(platformId);
        success(list);
    }

    @RequestMapping(path = "save")
    public void save(ServletRequest arg0, ServletResponse arg1) throws IOException {
        BcSendPlatformDataStrategyModel model = DSRequestUnit.getModel(BcSendPlatformDataStrategyModel.class);
        BcSendPlatformDataStrategyService.getInstance().create(model);
        success("");
    }

    @RequestMapping(path = "update")
    public void update(ServletRequest arg0, ServletResponse arg1) throws IOException {
        BcSendPlatformDataStrategyModel model = DSRequestUnit.getModel(BcSendPlatformDataStrategyModel.class);
        BcSendPlatformDataStrategyService.getInstance().update(model);
        success("");
    }

    @RequestMapping(path = "delete")
    public void delete(ServletRequest arg0, ServletResponse arg1) throws IOException {
        String platformId = DSRequestUnit.getParameter("id");
        BcSendPlatformDataStrategyService.getInstance().delete(platformId);
        success("");
    }
}
